package jeesample.model;

import java.util.Date;

import com.google.gson.Gson;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "Booking")
public class Booking {

	public static final String HASHCODE = "HashCode";
	public static final String STARTTIME = "StartTime";
	public static final String ENDTIME = "EndTime";
	public static final String BOOKEDBY = "BookedBy";
	public static final String ROOMID = "RoomId";
	public static final String BOOKINGID = "BookingId";
	public static final String COMMENTS = "Comments";

	@DatabaseField(generatedId = true)
	private int id;

	@DatabaseField(persisted = false)
	private String hashCode;

	@DatabaseField(columnName = STARTTIME)
	private Date startTime;
	@DatabaseField(columnName = ENDTIME)
	private Date endTime;

	@DatabaseField(columnName = BOOKEDBY, index = true)
	private String bookedBy;

	@DatabaseField(columnName = ROOMID, index = true)
	private String roomId;

	@DatabaseField(columnName = BOOKINGID, index = true)
	private String bookingId;

	@DatabaseField(columnName = COMMENTS)
	private String comments;

	// all persisted classes must define a no-arg constructor with at least
	// package visibility
	public Booking() {
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public String getRoomId() {
		return roomId;
	}

	public void setRoomId(String roomId) {
		this.roomId = roomId;
	}

	public String getBookedBy() {
		return bookedBy;
	}

	public void setBookedBy(String bookedBy) {
		this.bookedBy = bookedBy;
	}

	public String getHashCode() {
		return hashCode;
	}

	public void setHashCode(String hashCode) {
		this.hashCode = hashCode;
	}

	public String getBookingId() {
		return bookingId;
	}

	public void setBookingId(String bookingId) {
		this.bookingId = bookingId;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public String toString() {
		Gson gson = new Gson();
		return gson.toJson(this);
	}

}
